package cn.huhst.cas.weisiqian.pojo;

import cn.huhst.cas.weisiqian.util.JSON;

public class Picture {

	private String competitionname;
	private String picturedesc;
	private String picturename;

	public Picture() {

	}

	public Picture(String competitionname, String picturedesc, String picturename) {
		this.competitionname = competitionname;
		this.picturedesc = picturedesc;
		this.picturename = picturename;
	}

	public static final JSON checkCompetitionnameFormat(String competitionname, JSON json) {
		if (competitionname.length() > 40) {
			json.put("competitionname", "比赛名称长度不超过40");
		}
		return json;
	}

	public static final JSON checkPicturedescFormat(String picturedesc, JSON json) {
		if (picturedesc.length() > 100) {
			json.put("picturedesc", "照片描述长度不超过100");
		}
		return json;
	}

	public static final JSON checkPicturenameFormat(String picturename, JSON json) {
		if (picturename.length() > 50) {
			json.put("picturename", "照片名称长度不超过50");
		}
		return json;
	}

	public JSON checkFormat() {
		JSON json = new JSON();
		json = checkCompetitionnameFormat(competitionname, json);
		json = checkPicturedescFormat(picturedesc, json);
		json = checkPicturenameFormat(picturename, json);
		return json;
	}

	public String getCompetitionname() {
		return competitionname;
	}

	public void setCompetitionname(String competitionname) {
		this.competitionname = competitionname;
	}

	public String getPicturedesc() {
		return picturedesc;
	}

	public void setPicturedesc(String picturedesc) {
		this.picturedesc = picturedesc;
	}

	public String getPicturename() {
		return picturename;
	}

	public void setPicturename(String picturename) {
		this.picturename = picturename;
	}

	@Override
	public String toString() {
		return "PhotoWall [competitionname=" + competitionname + ", picturedesc=" + picturedesc + ", picturename="
				+ picturename + "]";
	}

}
